package svc

import (
	"github.com/redis/go-redis/v9"
	"github.com/zeromicro/go-zero/zrpc"
	"userapi/internal/config"
	"userrpc/userrpcclient"
)

type ServiceContext struct {
	Config  config.Config
	UserRpc userrpcclient.Userrpc
	Redis   *redis.Client
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:  c,
		UserRpc: userrpcclient.NewUserrpc(zrpc.MustNewClient(c.UserRpc)),
		Redis: redis.NewClient(&redis.Options{
			Addr: "localhost:6379",
			DB:   0,
		}),
	}
}
